package com.panshi.service;

import com.github.pagehelper.PageInfo;
import com.panshi.domain.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Component
@FeignClient(value = "hasbei-search-provider")
public interface ISearchFeignClient {

    /**
     * 关键字搜索
     *
     *  默认分页
     *  , defaultValue = "1"
     *  , defaultValue = "10"
     */
    @GetMapping("/search/{keyword}")
    PageInfo<Search> queryKeyword(@PathVariable(value = "keyword") String keyword,
                                  @RequestParam(value = "page") Integer page,
                                  @RequestParam(value = "pageSize") Integer pageSize);

    // 查询问答
    @GetMapping("/queryEssay/{essayId}")
    Essay queryEssay(@PathVariable long essayId);

    // 查询收藏
    @GetMapping("/queryCollect/{userId}")
    List<Collect> queryCollect(@PathVariable long userId);

    // 增加收藏
    @GetMapping("/addCollect")
    void addCollect(@PathVariable Collect collect);

    // 删除收藏
    @GetMapping("/deleteCollect/{id}")
    void deleteCollect(@PathVariable long id);

}
